﻿using System;
class ContainedSubstring
{
    static void Main()
    {
        int index = 0;
        int result = 0;
        int curPosit = 0;
        Console.Write("input string: ");
        string expression = Console.ReadLine();
        Console.Write("input substring: ");
        string substr = Console.ReadLine();
        expression = expression.ToLower();
        substr = substr.ToLower();
        for (int i = 0; i < expression.Length - substr.Length; i++)
			{
                index = expression.IndexOf(substr,curPosit);
                if (index != -1)
                {
                    result++;
                    curPosit = index + substr.Length; ;
                } 
			}
        if (result != 0)
        {
            Console.WriteLine("string \"{0}\" is found {1} times!", substr, result);
        }
        else
        {
            Console.Write("string \"{0}\" was not found!", substr);
        }
        Console.ReadLine();
    }
}

